package com.amap.search.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@Configuration
public class RestTemplateConfig {
    @Bean(name = "restTemplate")
    public RestTemplate restTemplate(SimpleClientHttpRequestFactory httpsFactory){
        return new RestTemplate(httpsFactory);
    }

    @Bean(name = "httpsFactory")
    public SimpleClientHttpRequestFactory clientHttpRequestFactory(){
        SimpleClientHttpRequestFactory httpsFactory = new SimpleClientHttpRequestFactory();
        httpsFactory.setReadTimeout(3000);
        httpsFactory.setConnectTimeout(3000);
        return httpsFactory;
    }

}
